abstract class Animal{
    name:string;
    constructor(name:string){
        this.name = name;
    }

    abstract sayName():void;
}

class Dog extends Animal{
    age:number;
    constructor(name:string,age:number){
        super(name);
        this.age = age;
    }
    sayName(): void {
        console.log(`我是${this.name},我今年${this.age}岁了`);
    }
}

const dog = new Dog("旺财",23)
dog.sayName() // 我是旺财,我今年23岁了